ENH: testing.lazy_xp_function: torch.compile support - #668
Conversation
| if jit_library is JitLibrary.jax and isinstance(obj, Iterator): | ||
| self._obj = list(obj) | ||
| self._is_iter = True |
There was a problem hiding this comment.
claude reckoned that, unlike JAX, we needn't treat iterables with this special case for torch.compile
| wrapped = autojit(func, JitLibrary.jax) | ||
| # If we're dealing with a staticmethod or classmethod, make | ||
| # sure things stay that way. | ||
| if isinstance(attr, staticmethod): | ||
| wrapped = staticmethod(wrapped) | ||
| elif isinstance(attr, classmethod): | ||
| wrapped = classmethod(wrapped) | ||
| temp_setattr(target, name, wrapped) | ||
|
|
||
| elif is_torch_namespace(xp): | ||
| for target, name, attr, func, tags in iter_tagged(): | ||
| if tags["torch_compile"]: | ||
| wrapped = autojit(func, JitLibrary.torch) |
There was a problem hiding this comment.
(minor: could reduce some LoC perhaps)
|
@ev-br FYI |
lucascolley
left a comment
There was a problem hiding this comment.
I think the warnings about to flood CI should be fixed by data-apis/array-api-compat#411 (comment).
393dd61 to
cc4a106
Compare
|
ready for review |
cc4a106 to
f16d510
Compare
|
@lucascolley what's the current status here? Is it just review bandwidth preventing this from moving forward? |
Yes, pretty much. I had also noted in the linked issue:
|
While I haven't written a single LOC, a reasonable design looks similar what is done for dask: an extra Also we definitely want to test things twice: in the eager mode and under torch dynamo. Not sure if it's already done for Jax (and if yes, where) or if it needs implementing. |
Do we need that level of granularity? Could we not have 3 options:
|
Would be happy to start with that at least if we can get that working. |
|
Do you have a preference for what that api would look like? Would it be acceptable to have both a |
f16d510 to
27d1036
Compare
not sure yet what I think is nicest... see also #917 |
I guess the one difference being we also want to be able to turn compile on/off and control if graph breaks are allowed |
27d1036 to
3578053
Compare
03c9eb8 to
b6cc704
Compare
b6cc704 to
20003c6
Compare
|
CI is happy now, with
|
Closes gh-664
@rgommers this was easier than I expected. Is there someone familiar with Dynamo that we could ping? A few things that came up:
torch.compile:(Draft PR as this will need docs updates before merge.)